package com.msb.apiboss.controller;

import com.msb.apiboss.service.DriverUserService;
import com.msb.commons.dto.Car;
import com.msb.commons.dto.DriverCarBindingRelationship;
import com.msb.commons.dto.DriverUser;
import com.msb.commons.response.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: chshh
 * @version: 1.0
 */
@RestController
public class DriverUserController {

    @Autowired
    private DriverUserService driverUserService;

    @PostMapping("/driver-user")
    public ResponseResult addDriveUser(@RequestBody DriverUser driveUser){
        return driverUserService.addDriverUser(driveUser);
    }

    @PutMapping("/driver-user")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser){
        return driverUserService.updateDriverUser(driverUser);
    }

    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car){
        return driverUserService.addCar(car);
    }

    @PostMapping("/driverCarBindingRelationship/bind")
    public ResponseResult bind(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship){
        return driverUserService.bind(driverCarBindingRelationship);
    }

    @PostMapping("/driverCarBindingRelationship/unbind")
    public ResponseResult unbind(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship){
        return driverUserService.unbind(driverCarBindingRelationship);
    }
}